Optimal. Leaf size=57 \[ \frac {2 a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a^2 \cot (c+d x)}{d}-\frac {2 a^2 \csc (c+d x)}{d}+\frac {a^2 \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 57, normalized size of antiderivative = 1.00, number of steps
used = 11, number of rules used = 9, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {3957, 2952,
3852, 8, 2701, 327, 213, 2700, 14} \begin {gather*} \frac {a^2 \tan (c+d x)}{d}-\frac {2 a^2 \cot (c+d x)}{d}-\frac {2 a^2 \csc (c+d x)}{d}+\frac {2 a^2 \tanh ^{-1}(\sin (c+d x))}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 14
Rule 213
Rule 327
Rule 2700
Rule 2701
Rule 2952
Rule 3852
Rule 3957
Rubi steps
\begin {align*} \int \csc ^2(c+d x) (a+a \sec (c+d x))^2 \, dx &=\int (-a-a \cos (c+d x))^2 \csc ^2(c+d x) \sec ^2(c+d x) \, dx\\ &=\int \left (a^2 \csc ^2(c+d x)+2 a^2 \csc ^2(c+d x) \sec (c+d x)+a^2 \csc ^2(c+d x) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 \int \csc ^2(c+d x) \, dx+a^2 \int \csc ^2(c+d x) \sec ^2(c+d x) \, dx+\left (2 a^2\right ) \int \csc ^2(c+d x) \sec (c+d x) \, dx\\ &=-\frac {a^2 \text {Subst}(\int 1 \, dx,x,\cot (c+d x))}{d}+\frac {a^2 \text {Subst}\left (\int \frac {1+x^2}{x^2} \, dx,x,\tan (c+d x)\right )}{d}-\frac {\left (2 a^2\right ) \text {Subst}\left (\int \frac {x^2}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d}\\ &=-\frac {a^2 \cot (c+d x)}{d}-\frac {2 a^2 \csc (c+d x)}{d}+\frac {a^2 \text {Subst}\left (\int \left (1+\frac {1}{x^2}\right ) \, dx,x,\tan (c+d x)\right )}{d}-\frac {\left (2 a^2\right ) \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d}\\ &=\frac {2 a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 a^2 \cot (c+d x)}{d}-\frac {2 a^2 \csc (c+d x)}{d}+\frac {a^2 \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(401\) vs. \(2(57)=114\).
time = 6.12, size = 401, normalized size = 7.04 \begin {gather*} -\frac {\cos ^2(c+d x) \log \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right ) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2}{2 d}+\frac {\cos ^2(c+d x) \log \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right ) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2}{2 d}+\frac {\cos ^2(c+d x) \csc \left (\frac {c}{2}\right ) \csc \left (\frac {c}{2}+\frac {d x}{2}\right ) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \sin \left (\frac {d x}{2}\right )}{2 d}+\frac {\cos ^2(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \sin \left (\frac {d x}{2}\right )}{4 d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )}+\frac {\cos ^2(c+d x) \sec ^4\left (\frac {c}{2}+\frac {d x}{2}\right ) (a+a \sec (c+d x))^2 \sin \left (\frac {d x}{2}\right )}{4 d \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}+\frac {d x}{2}\right )+\sin \left (\frac {c}{2}+\frac {d x}{2}\right )\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.07, size = 77, normalized size = 1.35
method | result | size |
derivativedivides | \(\frac {a^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )+2 a^{2} \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )-a^{2} \cot \left (d x +c \right )}{d}\) | \(77\) |
default | \(\frac {a^{2} \left (\frac {1}{\sin \left (d x +c \right ) \cos \left (d x +c \right )}-2 \cot \left (d x +c \right )\right )+2 a^{2} \left (-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )-a^{2} \cot \left (d x +c \right )}{d}\) | \(77\) |
norman | \(\frac {\frac {2 a^{2}}{d}-\frac {4 a^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {2 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {2 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) | \(97\) |
risch | \(-\frac {2 i a^{2} \left (2 \,{\mathrm e}^{2 i \left (d x +c \right )}-{\mathrm e}^{i \left (d x +c \right )}+3\right )}{d \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}\) | \(103\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 74, normalized size = 1.30 \begin {gather*} -\frac {a^{2} {\left (\frac {2}{\sin \left (d x + c\right )} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + a^{2} {\left (\frac {1}{\tan \left (d x + c\right )} - \tan \left (d x + c\right )\right )} + \frac {a^{2}}{\tan \left (d x + c\right )}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.49, size = 101, normalized size = 1.77 \begin {gather*} \frac {a^{2} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) - a^{2} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) - 3 \, a^{2} \cos \left (d x + c\right )^{2} - 2 \, a^{2} \cos \left (d x + c\right ) + a^{2}}{d \cos \left (d x + c\right ) \sin \left (d x + c\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int 2 \csc ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int \csc ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int \csc ^{2}{\left (c + d x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.48, size = 90, normalized size = 1.58 \begin {gather*} \frac {2 \, {\left (a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}\right )}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.13, size = 70, normalized size = 1.23 \begin {gather*} \frac {4\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-2\,a^2}{d\,\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )}+\frac {4\,a^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________